from django.db import models


class Company(models.Model):
    id_card = models.CharField(max_length=100, help_text='公司编码')
    name = models.CharField(max_length=100, help_text='公司名称')
    legal_person = models.CharField(max_length=30, help_text='法人姓名')
    address = models.CharField(max_length=254, help_text='公司地址')
    set_up_date = models.DateField(help_text='成立日期')
    create_time = models.DateTimeField(auto_now_add=True, help_text='创建时间')
    update_time = models.DateTimeField(auto_now=True, help_text='更新时间')

    class Meta:
        db_table = 'company'
        ordering = ('-set_up_date', '-id')

    def __str__(self):
        return f'<Company:({self.pk}, {self.id_card}, {self.name}, {self.set_up_date}, {self.create_time})>'

    __repr__ = __str__
